home *** CD-ROM | disk | FTP | other *** search
/ Aminet 39 / Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso / Aminet / util / conv / List2HTML.lha / List2HTML / Source / List2HTML.asc next >
Encoding:
Text File  |  2000-07-08  |  20.1 KB  |  611 lines

  1. ;*************
  2. ;* List2HTML *
  3. ;*************
  4.  
  5. ; -= ADDITIONAL LIBRARYS REQUIRED =-
  6.  
  7. ; 1) EFMUILib V1.5 by VIVID Imagination
  8.  
  9. ;    Note: Modifide by me to include MUITrue & MUIFalse
  10. ;    ===== in this programme. Add your own function with
  11. ;          MUITrue=1 & MUIFalse=False (NOTE! MUITrue <> True).
  12.  
  13. ; 2) romulusrequesterlib
  14. ; 3) RIAMOSFuncLib V1.36 by Steven Matty
  15. ; 4) neilsreqtoolslib by Neil O'Rourke
  16. ; 5) ElmoreDosLib V2.2 by Richard T. Elmore of Headsoft Software
  17. ; 6) ElmoreFuncsLib by Richard T. Elmore of Headsoft Software
  18. ; 7) ElmoreHardwareLib by Richard T. Elmore of Headsoft Software
  19. ; 8) ElmoreMathLib by Richard T. Elmore of Headsoft Software
  20.  
  21. ; Copy of Steves.res Included
  22.  
  23. ;*************************************
  24. ;* Copyright 2000 Steve Turner       *
  25. ;* address: 21 Oxford Close          *
  26. ;*          Washingborough           *
  27. ;*          Lincoln                  *
  28. ;*          LN4 1DT                  *
  29. ;*          UK                       *
  30. ;* e-mail : stevet@redhotant.co.uk   *
  31. ;*************************************
  32.  
  33. ;*************************************
  34. ;* This Prog. Is FreeWare But Do Not *
  35. ;* Distribute Amended Copies WithOut *
  36. ;* Adding Amendment Notes!!          *
  37. ;*************************************
  38.  
  39. Goto CONSTANTS
  40. Dc.b "$VER: List2HTML V1.0 (8/7/00)"
  41. Even
  42.  
  43. ;-----CONSTANTS----------------------------------------------------
  44. .CONSTANTS
  45.  
  46. #OBJECT_ID          =0
  47.  
  48. #MWText             =!NEWOBJ      ;MUI Object numbers
  49. #MWStatus           =!NEWOBJ
  50. #MWQuitB            =!NEWOBJ
  51. #MWSpace            =!NEWOBJ
  52. #MWHGrpA            =!NEWOBJ
  53. #MWVGrpA            =!NEWOBJ
  54. #MWin               =!NEWOBJ
  55. #MUIApp             =!NEWOBJ
  56. #MWConvertB         =!NEWOBJ
  57. #CWText             =!NEWOBJ
  58. #CWNoText           =!NEWOBJ
  59. #CWin               =!NEWOBJ
  60. #CWOkB              =!NEWOBJ
  61. #CWHGrpA            =!NEWOBJ
  62. #CWVGrpA            =!NEWOBJ
  63. #CWSlide            =!NEWOBJ
  64.  
  65. #HIGHEST_MUI_OBJECT =!NEWOBJ      ;Highest MUI Object Number + 1
  66.  
  67. #OBJECT_ID          =100          ;Workbench needs signal ID's over 100
  68.                                   ;Don't know if it's fixed in V3.1 or V3.5
  69.  
  70.                                   ;Application Signal ID's
  71. #MWClose            =#MUIV_Application_ReturnID_Quit
  72. #Convert            =!NEWOBJ
  73. #CWOk               =!NEWOBJ
  74. #NewCol             =!NEWOBJ
  75.  
  76. #MAXTAGS            =10           ;Highest Number Of Tags Required
  77. #MAXLINE            =256          ;Maximum line length
  78.  
  79. ;-----INCLUDE INSTRUCTIONS-----------------------------------------
  80.  
  81. ;******************************
  82. ;* ADJUST THIS TO YOUR SYSTEM *
  83. ;******************************
  84.  
  85. INCDIR "Blitzwork:Statements/"
  86.  
  87. ;-----MACROS-------------------------------------------------------
  88. .MACROS
  89.  
  90. INCLUDE "MACRO"                   ;Get Standard Macros
  91.  
  92. Macro MUIErr
  93.   CNIF `0=2
  94.     If MUIObjLoc(`1)=0
  95.       x$=`2+"'"
  96.       Goto tellem
  97.     End If
  98.   CELSE
  99.     CERR "Invalid Number of !MUIErr parameters"
  100.   CEND
  101. End Macro
  102.  
  103. Macro Pen3
  104.   !ESC+"3"
  105. End Macro
  106.  
  107. Macro SE
  108.   "SYSTEM ERROR"+!NL+!NL
  109. End Macro
  110.  
  111. Macro Status
  112.   #MWStatus,#MUIA_Text_Contents
  113. End Macro
  114.  
  115. Macro NoGadgets
  116.   MUIAddTags `1,#MUIA_Window_CloseGadget,MUIFalse
  117.   MUIAddTags `1,#MUIA_Window_DepthGadget,MUIFalse
  118.   MUIAddTags `1,#MUIA_Window_SizeGadget,MUIFalse
  119.   MUIAddTags `1,#MUIA_Window_DragBar,MUIFalse
  120. End Macro
  121.  
  122. ;-----GLOBALS------------------------------------------------------
  123. .VARS
  124.  
  125. ;>NEWTYPES
  126.  
  127. Dim MyTags.TagItem(#MAXTAGS)      ;.TagItem= ti_Tag.l : ti_Data.l
  128. MyTags(0)\ti_Tag = #TAG_DONE,0    ;Start It Empty
  129.  
  130. Even
  131. DEFTYPE.s
  132. ;>STRINGS
  133.  
  134. ;****************************************
  135. v$="V1.0"            ;CHANGE VERSION HERE
  136. vd$=" (8/7/00)"      ;===================
  137. ;****************************************
  138.  
  139. about$=!Pen3+!NL+" Convert Lists to HTML Table "+v$
  140. about$=about$+!NL+" ===================================="
  141. about$=about$+!NL+!NL+" "+!Copy+" STEVE TURNER 2000 "+!Copy
  142. about$=about$+!NL+" e-mail: stevet@redhotant.com"+!NL
  143. about$=about$+!NL+" ===================================="
  144. about$=about$+!NL+!NL+" Lists must be a text file in the form of;"
  145. about$=about$+!NL+" [column 1 content]['tab'[col 2]...['tab'[col n]]] 'newline'"
  146. about$=about$+!NL+" Minimum line content is 'newline'"
  147. about$=about$+!NL+"                         and 'tab'[...'tab']'newline' is OK."
  148. about$=about$+!NL+" tab=chr$(9) newline=chr$(10) Max line length="+Str$(#MAXLINE)+!NL
  149. about$=about$+!NL+" Columns do not have to match text but text will always be"
  150. about$=about$+!NL+"  placed in the first column/s. (Unless tabs are provided)"+!NL
  151. about$=about$+!NL+" No headers of footers must exist in the input file"+!NL+!NL
  152. x$=""                             ;General use
  153. blank$=""                         ;Empty string
  154. title$="List 2 HTML"              ;Prog title
  155. err1$=!Centre+!SE+"Failure To Open Window"
  156. reqtitle$=title$+" Requester"     ;Standard Title for error requester
  157. but$="_OKay"                      ;Standard Text for button
  158. stdbody$="Sorry Unable to Open"+!NL+"MUI Object : '"
  159.                                   ;Standard Text for error requester
  160. inc$="Blitzwork:Statements/"      ;Include Path
  161. MaxLen inPath$=192                ;Strings for file handling
  162. MaxLen outPath$=192
  163. MaxLen inFi$=192
  164. MaxLen outFi$=192
  165. MaxLen inTot$=192
  166. MaxLen outTot$=192
  167. MaxLen row$=#MAXLINE              ;Maximum input file line length
  168. col$="Number of Columns ="        ;window text
  169. startcol$=" 1 "                   ;window start text
  170.  
  171. Dim Help$(#HIGHEST_MUI_OBJECT)    ;Text For Help Bubbles
  172. Help$(#MWQuitB)="Doh!"
  173. Help$(#MWConvertB)=!Centre+"Convert Text List"+!NLC+"To HTML Table"
  174. Help$(#MWStatus)="Current Program Status"
  175. Help$(#CWOkB)=!Centre+"Accept Setting"+!NLC+"And Close Window"
  176. Help$(#CWSlide)=!Centre+"Adjust Number"+!NLC+"Of Columns"
  177.  
  178. Even
  179. DEFTYPE.b
  180. ;>BYTES
  181.  
  182. done=False                        ;Loop terminater
  183. cdone=False                       ;Loop terminater
  184. n=0                               ;Loop counter
  185.  
  186. Even
  187. DEFTYPE.w
  188. ;>WORDS
  189.  
  190. p=0                               ;Pointer
  191.  
  192. Even
  193. DEFTYPE.f
  194. ;>FLOATS
  195.  
  196. Even
  197. DEFTYPE.q
  198. ;>QUICKS
  199.  
  200. Even
  201. DEFTYPE.l
  202. ;>LONGS
  203.  
  204. sigs=0                            ;Signal ID
  205. csigs=0                           ;Signal ID
  206. x=0                               ;General use variable
  207. cols=1                            ;Number of columns
  208.  
  209. ;------------------------------------------------------------------
  210. .STATEMENTS
  211. ;------------------------------------------------------------------
  212.  
  213. ;-= Usefull Statements & Functions =-
  214.  
  215. ;INCLUDE "NIB_include.bb2"  ;Use NewIcon Libary
  216. ;INCLUDE "EasyButton"       ;EasyButton{object.l,label }
  217. ;INCLUDE "BFWindow"         ;BFWindow{ window }
  218. ;INCLUDE "Draw3dBox"        ;Draw3dBox{ x, y, width, height, style }
  219. ;INCLUDE "FlashText"        ;FlashText{ window, x, y, no , text, speed }
  220. ;INCLUDE "ShowInfo"         ;ShowInfo{ directory, icon, screen number }
  221. ;INCLUDE "SavePaletteFile"  ;SavePaletteFile{ bitmap number, filename }
  222. ;INCLUDE "WOutline"         ;WOutline{ x1, y1, x2, y2, hilite, shadow }
  223. ;INCLUDE "GoNTSC"           ;GoNTSC{}
  224. ;INCLUDE "GoPAL"            ;GoPAL{}
  225. ;INCLUDE "WindowTitle"      ;WindowTitle{ window, window title, screen title }
  226. ;INCLUDE "CleanBorder"      ;CleanBorder{ window number }
  227. ;INCLUDE "CtrlC"            ;CtrlC{}
  228. ;INCLUDE "UnlockWindow"     ;UnLockWindow{ window, lock }
  229. ;INCLUDE "HidePointer"      ;HidePointer{ window }
  230. ;INCLUDE "UsePalette"       ;UsePalette{ screen, palette }
  231. ;INCLUDE "ShowPointer"      ;ShowPointer{ window }
  232. ;INCLUDE "CompareDates"     ;CompareDates { file 1, file 2 }
  233. ;INCLUDE "FileTime"         ;FileTime { filename }
  234. ;INCLUDE "FileDate"         ;FileDate { filename }
  235. INCLUDE  "Exist"            ;Exist { filename }
  236. ;INCLUDE "SetComment"       ;SetComment { filename, comment }
  237. ;INCLUDE "ReadComment"      ;ReadComment { filename }
  238. ;INCLUDE "WindowFlags"      ;WindowW { window }
  239. ;INCLUDE "WinMouseX"        ;WinMouseX {}
  240. ;INCLUDE "WinMouseY"        ;WinMouseY {}
  241. ;INCLUDE "SoundTime"        ;SoundTime { sound number }
  242. ;INCLUDE "LockWindow"       ;LockWindow { window }
  243. ;INCLUDE "WBVersion"        ;WBVersion {}
  244. ;INCLUDE "TimerWait"        ;TimerWait { seconds, microsecends }
  245. ;INCLUDE "WindowFillScreen" ;WindowFillScreen { window number, flags, title }
  246. ;INCLUDE "ReceiveCtrlC"     ;ReceiveCtrlC {}
  247. ;INCLUDE "WBColours"        ;ScreenMouseX {}
  248. ;INCLUDE "Name"             ;Name { old filename, new filename}
  249. ;INCLUDE "ScreenH"          ;ScreenH { screen number }
  250. ;INCLUDE "ScreenW"          ;ScreenW { screen number }
  251. ;INCLUDE "SetProgName"      ;SetProgName { new name }
  252. ;INCLUDE "IsScreenActive"   ;IsScreenActive { screen number }
  253. ;INCLUDE "Unhook"           ;Unhook { device: }
  254. ;INCLUDE "Hookup"           ;Hookup { device: }
  255. ;INCLUDE "GetArg"           ;GetArg {}
  256. ;INCLUDE "OpenShell"        ;OpenShell { x, y, width, height, title, flag(s) }
  257. ;INCLUDE "Del"              ;Del { file }
  258. ;INCLUDE "OSAssign"         ;OSAssign { assign name, path, type }
  259. ;INCLUDE "Value"            ;Value { number string }
  260. ;INCLUDE "ScreenOpened"     ;ScreenOpened { screen }
  261. ;INCLUDE "WindowOpened "    ;WindowOpened{ window number }
  262. ;INCLUDE "RTReq"            ;RTReq { title, body text, gadget }
  263. ;INCLUDE "TitleBarHeight"   ;TitleBarHeight { screen }
  264. ;INCLUDE "CentreWindowX "   ;CentreWindowX { width of window }
  265. ;INCLUDE "CentreWindowY"    ;CentreWindowY { height of window }
  266. ;INCLUDE "ChipSet"          ;ChipSet {}
  267. ;INCLUDE "WFBox"            ;WFBox { window, left, width, top, height }
  268. ;INCLUDE "StripFile"        ;StripFile { path & file name }
  269. ;INCLUDE "LockReq"          ;LockReq { title, body, gadget, type }
  270. ;INCLUDE "ProgsDir"         ;ProgsDir {}
  271. ;INCLUDE "CurrentDir"       ;CurrentDir {}
  272. ;INCLUDE "ProgsName"        ;ProgsName {}
  273. ;INCLUDE "ParentDir"        ;ParentDir { directory }
  274. ;INCLUDE "Memory"           ;Memory { type }
  275. ;INCLUDE "CheckLib"         ;CheckLib { library, version }
  276. ;INCLUDE "PixelLen"         ;PixelLen { text }
  277. ;INCLUDE "StripToDot"       ;StripToDot { filename }
  278. ;INCLUDE "Quoted"           ;Quoted { text }
  279. ;INCLUDE "CreateDir"        ;CreateDir { new directory }
  280. ;INCLUDE "CenterString"     ;CenterString { text, window }
  281. ;INCLUDE "SaveSound"        ;SaveSound { sound number, filename }
  282. ;INCLUDE "SendARexx"        ;SendARexx { arexx command }
  283. INCLUDE  "ASLFileRequest"   ;ASLFileRequest { title, path, file, pattern }
  284. ;INCLUDE "Planes2Cols"      ;Planes2Cols { number of bitplanes }
  285. ;INCLUDE "CheckPic"         ;CheckPic { picture file }
  286. ;INCLUDE "PicSafe"          ;PicSafe { picture file, type, safety }
  287. ;INCLUDE "SoundSafe"        ;SoundSafe { sound file, safety }
  288.  
  289. ;------------------------------------------------------------------
  290.  
  291. .Stat
  292.  
  293. Statement Stat{s$}          ;Update Status
  294.   MUISet !Status,&s$
  295. End Statement
  296.  
  297. ;------------------------------------------------------------------
  298.  
  299. .START
  300.  
  301. Even
  302. SetErr:End:End SetErr
  303. NoCli
  304. WBStartup
  305. CloseEd
  306. WbToScreen 0
  307.  
  308. .runit
  309.  
  310. ;Run the prog.
  311. ;-------------
  312.  
  313. ;Main window text
  314. ;----------------
  315.  
  316. MUINewObject #MWText,!Text,&about$
  317. !MUIErr{#MWText,"Main Window Text"}
  318. MUINewObject #MWStatus,!Text,&blank$,!Textframe,!TextBack
  319. !MUIErr{#MWStatus,"Main Window Status"}
  320. !Help{#MWStatus}
  321.  
  322. ;Column window text
  323. ;------------------
  324.  
  325. MUINewObject #CWText,!Text,&col$,!FixedFont
  326. !MUIErr{#CWText,"Column Window Text"}
  327. MUINewObject #CWNoText,!Text,&startcol$,!FixedFont
  328. !MUIErr{#CWNoText,"Column Window Number Text"}
  329.  
  330. ;Create Slider for column window
  331. ;-------------------------------
  332.  
  333. MUIAddTags #CWSlide,#MUIA_Slider_Quiet,MUITrue
  334. MUISlider #CWSlide,1,10,1
  335. !MUIErr{#CWSlide,"Column winder slider"}
  336. !Help{#CWSlide}
  337.  
  338. ;Create simple buttons
  339. ;---------------------
  340.  
  341. ;for main window
  342.  
  343. MUISimpleButton #MWQuitB,"_Quit"
  344. !MUIErr{#MWQuitB,"Main Window Quit Button"}
  345. !Help{#MWQuitB}
  346. MUISimpleButton #MWConvertB,"_Convert"
  347. !MUIErr{#MWConvertB,"Main Window Convert Button"}
  348. !Help{#MWConvertB}
  349.  
  350. ;for column window
  351.  
  352. MUISimpleButton #CWOkB," _O.K. "
  353. !MUIErr{#CWOkB,"Column Window OK Button"}
  354. !Help{#CWOkB}
  355.  
  356. ;Create space
  357. ;------------
  358.  
  359. ;for main window
  360.  
  361. MUIHVSpace #MWSpace
  362. !MUIErr{#MWSpace,"Main Window Space"}
  363. MUISet #MWSpace,#MUIA_HorizWeight,200
  364.  
  365. ;Creat column window horizontal group
  366. ;------------------------------------
  367.  
  368. MUIAddObjsHGroup #CWHGrpA,#CWText,#CWNoText,#CWOkB
  369. MUICreateHGroup #CWHGrpA
  370. !MUIErr{#CWHGrpA,"Column Window Horizontal Group"}
  371.  
  372. ;Create main window horizontal group
  373. ;-----------------------------------
  374.  
  375. MUIAddObjsHGroup #MWHGrpA,#MWConvertB,#MWSpace,#MWQuitB
  376. MUICreateVGroup #MWHGrpA
  377. !MUIErr{#MWHGrpA,"Main Window Horizontal Group A"}
  378.  
  379. ;Create column window vertical group
  380. ;-----------------------------------
  381.  
  382. MUIAddObjsVGroup #CWVGrpA,#CWHGrpA,#CWSlide
  383. MUICreateHGroup #CWVGrpA
  384. !MUIErr{#CWVGrpA,"Column Window Vertical Group"}
  385.  
  386. ;Create main window Vertical group
  387. ;---------------------------------
  388.  
  389. MUIAddObjsVGroup #MWVGrpA,#MWText,#MWHGrpA,#MWStatus
  390. MUICreateHGroup #MWVGrpA
  391. !MUIErr{#MWVGrpA,"Main Window Vertical Group A"}
  392.  
  393. ;Create main window
  394. ;------------------
  395.  
  396. MUIAddTags #MWin,#MUIA_Window_Width,!MUIV_Window_Width_Visible{90}
  397. MUIAddTags #MWin,!TopCentered,!LeftCentered
  398. MUIAddTags #MWin,#MUIA_Window_Height,!MUIV_Window_Height_Visible{33}
  399. MUICreateWindow #MWin,title$,"L2HL",#MWVGrpA
  400. !MUIErr{#MWin,"Main Window"}
  401.  
  402. ;Create column window
  403. ;--------------------
  404.  
  405. MUIAddTags #CWin,!TopMoused,!LeftMoused
  406. !NoGadgets{#CWin}
  407. MUICreateWindow #CWin,"","",#CWVGrpA
  408. !MUIErr{#CWin,"Column Window"}
  409. MUISet #CWin,#MUIA_Window_ID,0
  410.  
  411. ;Create Application
  412. ;------------------
  413.  
  414. MUIApplicationAuthor "Steve Turner"
  415. MUIApplicationBase "LIST2HTML"
  416. MUIApplicationCopyright "(c) 2000 By Steve Turner"
  417. MUIApplicationTitle "List2HTML"
  418. MUIApplicationVersion "List2HTML"+v$+vd$
  419. MUIApplicationDescription "Covert Lists to HTML Table"
  420. MUIAddApplicationTags #MUIA_Application_Window,MUIObjLoc(#MWin)
  421. MUIAddApplicationTags #MUIA_Application_Window,MUIObjLoc(#CWin)
  422. MUICreateApplication
  423. MUIApplicationObj #MUIApp
  424. !MUIErr{#MUIApp,"Application"}
  425.  
  426. ;Set up comunicators
  427. ;-------------------
  428.  
  429. ;Main window close gadget or commodity kill
  430. MUINotifyApp #MWin,#MUIA_Window_CloseRequest,MUITrue,#MWClose
  431. ;Main window quit button hit
  432. MUINotifyApp #MWQuitB,!Pushed,#MWClose
  433. ;main window convert button hit
  434. MUINotifyApp #MWConvertB,!Pushed,#Convert
  435. ;Column window OK button hit
  436. MUINotifyApp #CWOkB,!Pushed,#CWOk
  437. ;Column window slider moved
  438. MUINotifyApp #CWSlide,!SlideMove,#NewCol
  439.  
  440. ;Open main window
  441. ;----------------
  442.  
  443. MUIOpenWindow #MWin
  444. If MUIGet(#MWin,#MUIA_Window_Open)=MUIFalse
  445.   done=True
  446.   x=MUI_RequestA_(MUIObjLoc(#MUIApp),0,0,&reqtitle$,&but$,&err1$,0)
  447. End If
  448.  
  449. ;Monitor Input Until Quit By User
  450. ;--------------------------------
  451.  
  452. Stat{"Awaiting Your Instructions"}          ;Status waiting
  453. While done=False
  454.   sigs=MUIWaitEvent                         ;Wait for event
  455.   Select sigs                               ;And act on it
  456.     Case #MWClose                           ;Main window closed
  457.       done=True
  458.     Case #Convert                           ;Convert button pressed
  459.       Stat{"Getting Input File"}
  460.       MUISet #MWin,#MUIA_Window_Sleep,MUITrue
  461.       inTot$=ASLFileRequest{"Input File",inPath$,inFi$,"#?"}
  462.                                             ;Get input file
  463.       MUISet #MWin,#MUIA_Window_Sleep,MUIFalse
  464.       If inTot$<>""                         ;If input file given
  465.         Stat{"Input File : "+inTot$}
  466.         inPath$=PathPart$(inTot$)
  467.         inFi$=FilePart$(inTot$)
  468.         If outPath$=""                      ;If no Output stored
  469.           outPath$=inPath$                  ;use input directory
  470.         End If
  471.         MUISet #MWin,#MUIA_Window_Sleep,MUITrue
  472.         outTot$=ASLFileRequest{"Output File",outPath$,outFi$,"#?"}
  473.                                             ;Get output file
  474.         MUISet #MWin,#MUIA_Window_Sleep,MUIFalse
  475.         If outTot$<>""                      ;If output file given
  476.           outPath$=PathPart$(outTot$)
  477.           outFi$=FilePart$(outTot$)
  478.           Stat{"Convert "+inFi$+" to "+outFi$}
  479.           If Exist{inTot$}>0                ;Must be input file
  480.             If ReadFile(1,inTot$)=True      ;And must be able to read it
  481.               FileInput 1
  482.               If Exist{outTot$}>0           ;Backup any existing output file
  483.                 If Exist{outTot$+".bak"}>0
  484.                   KillFile(outTot$+".bak")
  485.                 End If
  486.                 x=Rename(outTot$,outTot$+".bak")
  487.               End If
  488.               If WriteFile(2,outTot$)=True  ;Must write to output file
  489.                 FileOutput 2
  490.                 MUISet #MWin,#MUIA_Window_Sleep,MUITrue
  491.                 MUIOpenWindow #CWin         ;Open window to get number of columns
  492.                 While cdone=False           ;Keep window open untill users done
  493.                   csigs=MUIWaitEvent        ;get input
  494.                   Select csigs
  495.                     Case #NewCol            ;Slider has been moved
  496.                       cols=MUIGet(#CWSlide,#MUIA_Numeric_Value)
  497.                                             ;Read new value
  498.                       Format "##"
  499.                       x$=Str$(cols)         ;Turn value into string
  500.                       MUISet #CWNoText,#MUIA_Text_Contents,&x$
  501.                                             ;Print new value in window
  502.                     Case #CWOk              ;User hit OK button
  503.                       MUICloseWindow #CWin  ;Close window and get out of this loop
  504.                       MUISet #MWin,#MUIA_Window_Sleep,MUIFalse
  505.                       cdone=True
  506.                   End Select
  507.                 Wend
  508.  
  509.                 ;Start output file with standard table header tags
  510.                 ;-------------------------------------------------
  511.  
  512.                 NPrint "<!-- AutoCreated Table with List2HTML -->"
  513.                 NPrint "<TABLE BORDER=1>"
  514.                 NPrint "  <CAPTION>Table</CAPTION>"
  515.                 NPrint "  <TR>"
  516.                 Format "00"
  517.                 For n=1 To cols
  518.                   NPrint "    <TH>Column "+Str$(n)+"</TH>"
  519.                 Next
  520.                 NPrint "  </TR>"
  521.  
  522.                 ;Continue for whole of input file
  523.                 ;--------------------------------
  524.  
  525.                 While NOT Eof(1)
  526.  
  527.                   ;Print tag and read in line upto #MAXLINE chars long
  528.                   ;---------------------------------------------------
  529.  
  530.                   NPrint "  <TR>"
  531.                   row$=Edit$(#MAXLINE)
  532.  
  533.                   ;For each column
  534.                   ;---------------
  535.  
  536.                   For n=1 To cols
  537.                     Stat{row$}
  538.                     p=Instr(row$,Chr$(9))     ;Find tab in string
  539.                     If p>0                    ;If exists
  540.                       x$=Left$(row$,p-1)      ;  Make x$=column content
  541.                       If p=Len(row$)          ;  Chop column off front of row$
  542.                         row$=""
  543.                       Else
  544.                         row$=Mid$(row$,p+1)
  545.                       End If
  546.                     Else
  547.                       x$=row$                 ;Make x$=column content
  548.                       row$=""                 ;Chop column off front of row$
  549.                     End If
  550.  
  551.                     ;Regardless of content of row$, x$ should = Column
  552.                     ;content and row$=rest of line, even if we have run
  553.                     ;out of text for the column - so add it to file
  554.                     ;--------------------------------------------------
  555.  
  556.                     NPrint "    <TD>"+x$+"</TD>"
  557.                   Next
  558.  
  559.                   NPrint "  </TR>"
  560.                 Wend
  561.  
  562.                 ;And end with standard table termination tags
  563.                 ;--------------------------------------------
  564.  
  565.                 NPrint "</TABLE>"
  566.                 NPrint "<!-- End of AutoTable -->"
  567.                 CloseFile 2                 ;Close output file
  568.               Else
  569.                 x$="Unable to Open Output File"
  570.                 x=MUI_RequestA_(MUIObjLoc(#MUIApp),0,0,&reqtitle$,but$,&x$,0)
  571.               End If
  572.               CloseFile 1                   ;Close input file
  573.             Else
  574.               x$="Unable to Open Input File"
  575.               x=MUI_RequestA_(MUIObjLoc(#MUIApp),0,0,&reqtitle$,but$,&x$,0)
  576.             End If
  577.           Else
  578.             x$="Unable to Find Input File"
  579.             x=MUI_RequestA_(MUIObjLoc(#MUIApp),0,0,&reqtitle$,but$,&x$,0)
  580.           End If
  581.         End If
  582.       End If
  583.       Stat{"Done"}                          ;Done a loop set status
  584.   End Select
  585. Wend
  586.  
  587. ;Cleanup
  588. ;-------
  589.  
  590. MUIRemoveApplication
  591. Free Screen 0
  592.  
  593. ;And Done
  594. ;--------
  595.  
  596. End
  597.  
  598. .tellem
  599.  
  600. ;Report MUI Object open error
  601. ;----------------------------
  602.  
  603. Window 0,0,0,10,10,#BORDERLESS,"",0,0
  604. x=EasyRequest(0,reqtitle$,stdbody$+x$,but$)
  605. Free Window 0
  606. Free Screen 0
  607. End
  608.  
  609. ;------END---------------------------------------------------------
  610.  
  611.